package ocean.chinacraft.data;

import ocean.chinacraft.common.constants.Constants;
import ocean.chinacraft.data.recipes.JadeWorkbenchRecipe;
import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraft.item.crafting.IRecipeType;
import net.minecraft.util.registry.Registry;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;

/**
 * 注册自定义合成表
 *
 * @author zhang
 * @since 2021/11/20
 */
public class ModRecipeTypes {

    public static final DeferredRegister<IRecipeSerializer<?>> RECIPE_SERIALIZER =
            DeferredRegister.create(ForgeRegistries.RECIPE_SERIALIZERS, Constants.MOD_ID);

    public static final RegistryObject<JadeWorkbenchRecipe.Serializer> JADE_WORKBENCH_TYPE
            = RECIPE_SERIALIZER.register("jade_workbench_type", JadeWorkbenchRecipe.Serializer::new);

    public static IRecipeType<JadeWorkbenchRecipe> JADE_WORKBENCH_RECIPE = new JadeWorkbenchRecipe.JadeWorkbenchRecipeType();

    public static void register(IEventBus eventBus) {
        RECIPE_SERIALIZER.register(eventBus);
        Registry.register(Registry.RECIPE_TYPE, JadeWorkbenchRecipe.TYPE_ID, JADE_WORKBENCH_RECIPE);
    }
}
